<?php
include('connection.php');
$teacher_id = $_POST['teacher'];
$faculty = $_POST['faculty'];
$group = $_POST['group'];
$lesson = $_POST['lesson'];
$query="SELECT * FROM manager_registration_for_teachers WHERE teach_login='$login' AND teach_type_lessons='$lessons'";
$result = mysql_query($query);
$num=mysql_numrows($result);
if ($num==0){
	header( "Location: ../manager_teachers.php?status=wrong" );
}
if(!isset($_POST['tip']))
{
	$tip = "no lessons";
}
else
{
	if(!empty($_POST['tip']))
	{
		foreach($_POST['tip'] as $check)
		{
            $tip.=$check."|";
		}
	}
}
$login = $user_login;
$query="INSERT INTO manager_registration_for_teachers VALUES ('', '$teacher_id','$faculty', '$group', '$lesson', '$tip');";
$result = mysql_query($query); 
$_SESSION['alert'] = $result;
header( "Location: ../manager_timetable.php");
?>
